<%include pub/admin_head.html%>
    </head>
    <body>
        <!-- Page Container -->
        <div class="page-container">
            <%include pub/admin_nav.html%>
            <!-- Page Content -->
            <div class="page-content">
            	<%include pub/admin_top.html%>
                <div class="page-inner">
                	<div class="page-title">
                        <h3 class="breadcrumb-header">增加推送</h3>
                    </div>
                    <div id="main-wrapper">
                        <div class="col-md-6">
                            <div class="panel-body">
								<div class="form-group">
									<label>用户ID</label>
									<input type="text" class="form-control" id="admin-addnotice-id" >
								</div>
								<div class="form-group">
									<label>推送标题</label>
									<input type="text" class="form-control" id="admin-addnotice-title">
								</div>
								<div class="form-group">
									<label>推送内容</label>
									<input type="text" class="form-control" id="admin-addnotice-content">
								</div>
								<button type="button" class="btn btn-primary" id="admin-addnotice-btn">确认</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
      	<!-- Javascripts -->
        <%include pub/admin_foot.html%>
        <script type="text/javascript">
        	$('#admin-addnotice-btn').click(function(){
        		let userid = $('#admin-addnotice-id').val();
				let title = $('#admin-addnotice-title').val();
				let content =$('#admin-addnotice-content').val();
				if(userid && title && content){
					$.ajax({
						url:'/admin/tuisong/add',
						type:'POST',
						data:{
							user:userid,
							title:title,
							content:content
						},
						success:function(data){
							if(data.status == 'success'){
								alert('推送成功')
							}else{
								alert('推送失败')
							}
						},
						error:function(){
							alert('推送失败')
						}
					})
				}else{
					alert('输入框不能为空')
				}
			})
        </script>
    </body>
</html>